/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication1;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Bienes
 */
@Entity
@Table(name = "inventory_products", catalog = "starter", schema = "")
@NamedQueries({
    @NamedQuery(name = "InventoryProducts.findAll", query = "SELECT i FROM InventoryProducts i"),
    @NamedQuery(name = "InventoryProducts.findByProductID", query = "SELECT i FROM InventoryProducts i WHERE i.productID = :productID"),
    @NamedQuery(name = "InventoryProducts.findByProductName", query = "SELECT i FROM InventoryProducts i WHERE i.productName = :productName"),
    @NamedQuery(name = "InventoryProducts.findByProductType", query = "SELECT i FROM InventoryProducts i WHERE i.productType = :productType"),
    @NamedQuery(name = "InventoryProducts.findByProductLabel", query = "SELECT i FROM InventoryProducts i WHERE i.productLabel = :productLabel"),
    @NamedQuery(name = "InventoryProducts.findByProductSupplier", query = "SELECT i FROM InventoryProducts i WHERE i.productSupplier = :productSupplier"),
    @NamedQuery(name = "InventoryProducts.findByProductPrice", query = "SELECT i FROM InventoryProducts i WHERE i.productPrice = :productPrice"),
    @NamedQuery(name = "InventoryProducts.findByProductQuantity", query = "SELECT i FROM InventoryProducts i WHERE i.productQuantity = :productQuantity")})
public class InventoryProducts implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ProductID")
    private Integer productID;
    @Column(name = "ProductName")
    private String productName;
    @Column(name = "ProductType")
    private String productType;
    @Column(name = "ProductLabel")
    private String productLabel;
    @Column(name = "ProductSupplier")
    private String productSupplier;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "ProductPrice")
    private Float productPrice;
    @Column(name = "ProductQuantity")
    private Integer productQuantity;

    public InventoryProducts() {
    }

    public InventoryProducts(Integer productID) {
        this.productID = productID;
    }

    public Integer getProductID() {
        return productID;
    }

    public void setProductID(Integer productID) {
        Integer oldProductID = this.productID;
        this.productID = productID;
        changeSupport.firePropertyChange("productID", oldProductID, productID);
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        String oldProductName = this.productName;
        this.productName = productName;
        changeSupport.firePropertyChange("productName", oldProductName, productName);
    }

    public String getProductType() {
        return productType;
    }

    public void setProductType(String productType) {
        String oldProductType = this.productType;
        this.productType = productType;
        changeSupport.firePropertyChange("productType", oldProductType, productType);
    }

    public String getProductLabel() {
        return productLabel;
    }

    public void setProductLabel(String productLabel) {
        String oldProductLabel = this.productLabel;
        this.productLabel = productLabel;
        changeSupport.firePropertyChange("productLabel", oldProductLabel, productLabel);
    }

    public String getProductSupplier() {
        return productSupplier;
    }

    public void setProductSupplier(String productSupplier) {
        String oldProductSupplier = this.productSupplier;
        this.productSupplier = productSupplier;
        changeSupport.firePropertyChange("productSupplier", oldProductSupplier, productSupplier);
    }

    public Float getProductPrice() {
        return productPrice;
    }

    public void setProductPrice(Float productPrice) {
        Float oldProductPrice = this.productPrice;
        this.productPrice = productPrice;
        changeSupport.firePropertyChange("productPrice", oldProductPrice, productPrice);
    }

    public Integer getProductQuantity() {
        return productQuantity;
    }

    public void setProductQuantity(Integer productQuantity) {
        Integer oldProductQuantity = this.productQuantity;
        this.productQuantity = productQuantity;
        changeSupport.firePropertyChange("productQuantity", oldProductQuantity, productQuantity);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (productID != null ? productID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof InventoryProducts)) {
            return false;
        }
        InventoryProducts other = (InventoryProducts) object;
        if ((this.productID == null && other.productID != null) || (this.productID != null && !this.productID.equals(other.productID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "javaapplication1.InventoryProducts[ productID=" + productID + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
